home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol E-12
/
(Vol E-12) May 21 2012.iso
/
Animations
/
dj
/
dj.swf
/
scripts
/
__Packages
/
mx
/
controls
/
streamingmedia
/
PlayPauseButton.as
< prev
next >
Wrap
Text File
|
2012-05-21
|
3KB
|
100 lines
class mx.controls.streamingmedia.PlayPauseButton extends MovieClip
{
function PlayPauseButton()
{
super();
this.init();
}
function init()
{
this._controller = this._parent._parent;
this.attachMovie("Button","_playPauseButton",1);
this._playPauseButton.setSize(50,22);
this._playPauseButton._x = 0;
this._playPauseButton._y = 0;
this._playPauseButton.addEventListener("click",this);
this._isPlaying = !this._controller.isPlaying();
this.__set__enabled(this._controller.enabled);
this.tabEnabled = false;
this.tabChildren = true;
}
function showPlayButton()
{
mx.controls.streamingmedia.Tracer.trace("PlayPauseButton.showPlayButton");
this._isPlaying = true;
this.assignIcon();
}
function showPauseButton()
{
mx.controls.streamingmedia.Tracer.trace("PlayPauseButton.showPauseButton");
this._isPlaying = false;
this.assignIcon();
}
function get enabled()
{
return this._playPauseButton.enabled;
}
function set enabled(is)
{
this._playPauseButton.enabled = is;
this.assignIcon();
}
function assignIcon()
{
var _loc3_ = this.__get__enabled();
var _loc5_ = this._isPlaying;
mx.controls.streamingmedia.Tracer.trace("PlayPauseButton.assignIcon: start: enabled=" + _loc3_ + ", play=" + _loc5_);
var _loc2_ = "";
if(_loc5_)
{
_loc2_ = !_loc3_ ? "icon.play-disabled" : "icon.play";
}
else
{
_loc2_ = !_loc3_ ? "icon.pause-disabled" : "icon.pause";
}
mx.controls.streamingmedia.Tracer.trace("PlayPauseButton.assignIcon: icon=" + _loc2_);
var _loc4_ = this._playPauseButton.enabled;
if(!_loc4_)
{
this._playPauseButton.enabled = true;
}
this._playPauseButton.__set__icon(_loc2_);
if(!_loc4_)
{
this._playPauseButton.enabled = false;
}
mx.controls.streamingmedia.Tracer.trace("PlayPauseButton.assignIcon: done");
}
function click(ev)
{
if(this._isPlaying)
{
this.playClick();
}
else
{
this.pauseClick();
}
}
function playClick()
{
var _loc2_ = this._controller;
mx.controls.streamingmedia.Tracer.trace("PlayButton.click: playAtBeginning=" + _loc2_.playAtBeginning);
if(_loc2_.playAtBeginning)
{
_loc2_.broadcastEvent("playheadChange",0);
mx.controls.streamingmedia.Tracer.trace("PlayButton.click: playAtBeginning=false");
_loc2_.playAtBeginning = false;
}
_loc2_.broadcastEvent("click","play");
_loc2_.setPlaying(true);
}
function pauseClick()
{
var _loc2_ = this._controller;
_loc2_.broadcastEvent("click","pause");
_loc2_.setPlaying(false);
}
}